using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Material.Entity;
using System.Configuration;
using System.Data.SqlClient;
using Material.App.Report.Report;
using Material.App.Report.Dataset;

namespace Material.App
{
    public partial class FrmRptBarang : Form
    {
        private string connStr = ConfigurationManager.ConnectionStrings["dbconnection"].ToString();
        //private TblSatuan tblSatuan;
        private TblBarangEntity tblBarangEntity;
        public DateTime TglAwal;
        public DateTime TglAkhir;
        public bool AllReport;

        public FrmRptBarang()
        {
            InitializeComponent();
        }

        private void FrmRptSatuan_Load(object sender, EventArgs e)
        {
            
           
        }

        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            tblBarangEntity = new TblBarangEntity(connStr);
            SqlCommand comm = tblBarangEntity.GetCommandReport();
            if (!AllReport)
            {
                comm = tblBarangEntity.GetCommandReportByDate(TglAwal, TglAkhir);
            }
            SqlDataAdapter adp = new SqlDataAdapter(comm);
            dsTblSatuan ds = new dsTblSatuan();
            ds.Clear();
            adp.Fill(ds, "dtTblBarang");


            RptBarang rpt = new RptBarang();
            rpt.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rpt;
        }
    }
}